package com.example.app.pages.main.home.addNew.addRecord

import androidx.compose.animation.core.animateDpAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import com.example.app.cls.MyState
import com.example.app.components.MyScaffold.MyCustomScaffold
import com.example.app.components.MyText.MyText

class IncomeManageRelationState: MyState() {

}
@Composable
fun IncomeManageRelation(incomeManageRelationState: IncomeManageRelationState) {
    var visible = incomeManageRelationState.visible.collectAsState()
    var windowWidth = with(LocalDensity.current) {
        LocalConfiguration.current.screenWidthDp
    }
    var animateDpAsState =
        animateDpAsState(targetValue = if (visible.value) 0.dp else -windowWidth.dp)
    MyCustomScaffold(modifier = Modifier
        .offset(x = animateDpAsState.value)
        .width(windowWidth.dp)
        .fillMaxHeight()
        .background(Color.Blue)) {
        MyText(text = "测试")
    }
}